import { defineStore } from 'pinia'
export interface IWxConfigData {
  appid: string
  noncestr: string
  timestamp: number
  url: string
  signature: string
}
export const useCommonStore = defineStore('commonstore', {
  state: () => {
    return {
      visitUrl: '',
      token: '',
      title: '',
      wxConfigData: {
        appid: '',
        noncestr: '',
        timestamp: '',
        url: '',
        signature: '',
      },
      hasWxConfigData: false,
      isPm: false
    }
  },
  getters: {

  },
  actions: {
    saveIsPm(flag: boolean) {
      this.isPm = flag
    },
    saveHasWxConfig(flag: boolean): void {
      this.hasWxConfigData = flag
    },
    saveWxConfigData(data: IWxConfigData): void {
      this.wxConfigData = data
    },
    saveVisitUrl(url: string): void {
      this.visitUrl = url
    },
    saveTitile(title: string): void {
      this.title = title
    }
  }
})